<#assign assign_service="${service.interface.name?replace('I', '', 'f')?uncap_first}">
<#lt/>
<#lt/>
<#lt/>
package ${controller.package};

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zorn.core.spring.mvc.support.ControllerSupport;
import ${service.interface.namespace};

@Controller
@Scope("prototype")
@RequestMapping("${controller.mapping}")
public class ${controller.name} extends ControllerSupport {

	/* Fields
	================================================== */
	@Autowired
	private ${service.interface.name} ${assign_service};

	/* Methods
	================================================== */
	@ResponseBody
	@RequestMapping("${(controller.method.query.name)!"query"}")
	public Object ${(controller.method.query.name)!"query"}() {
		${assign_service}.${(service.interface.method.query.name)!"query"}(getParameterJSONObject());

		return toJSONString(${assign_service}.getResult(), true);
	}

	@ResponseBody
	@RequestMapping("${(controller.method.query.name)!"count"}")
	public Object ${(controller.method.count.name)!"count"}() {
		${assign_service}.${(service.interface.method.count.name)!"count"}(getParameterJSONObject());

		return toJSONString(${assign_service}.getResult());
	}

	@ResponseBody
	@RequestMapping("${(controller.method.query.name)!"insert"}")
	public Object ${(controller.method.insert.name)!"insert"}() {
		${assign_service}.${(service.interface.method.insert.name)!"insert"}(getParameterJSONObject());

		return toJSONString(${assign_service}.getResult());
	}

	@ResponseBody
	@RequestMapping("${(controller.method.query.name)!"update"}")
	public Object ${(controller.method.update.name)!"update"}() {
		${assign_service}.${(service.interface.method.update.name)!"update"}(getParameterJSONObject());

		return toJSONString(${assign_service}.getResult());
	}

	@ResponseBody
	@RequestMapping("${(controller.method.query.name)!"delete"}")
	public Object ${(controller.method.delete.name)!"delete"}() {
		${assign_service}.${(service.interface.method.delete.name)!"delete"}(getParameterJSONObject());

		return toJSONString(${assign_service}.getResult());
	}

	/* Getters & Setters
	================================================== */
	public void set${service.interface.name?replace('I', '', 'f')}(${service.interface.name} ${assign_service}) {
		this.${assign_service} = ${assign_service};
	}

}